part of 'card_info.dart';

class RepetitionAnswerTypingCardInfo extends Equatable implements CardInfo {
  RepetitionAnswerTypingCardInfo({
    String? cardId,
    required this.lexicalItem,
    required this.repeatableLexicalItemCount,
    required this.hintUsed,
    required this.finishEvent,
  }) : cardId = cardId ?? UuidGenerator().generateUuid();

  @override
  final String cardId;

  final LexicalItem lexicalItem;
  final int repeatableLexicalItemCount;
  final bool hintUsed;
  final RepetitionAnswerTypingCardFinishEvent finishEvent;

  @override
  List<Object?> get props {
    return [
      cardId,
      lexicalItem,
      repeatableLexicalItemCount,
      hintUsed,
      finishEvent,
    ];
  }

  RepetitionAnswerTypingCardInfo copyWith({
    String Function()? cardId,
    LexicalItem Function()? lexicalItem,
    int Function()? repeatableLexicalItemCount,
    bool Function()? hintUsed,
    RepetitionAnswerTypingCardFinishEvent Function()? finishEvent,
  }) {
    return RepetitionAnswerTypingCardInfo(
      cardId: cardId == null ? this.cardId : cardId(),
      lexicalItem: lexicalItem == null ? this.lexicalItem : lexicalItem(),
      repeatableLexicalItemCount: repeatableLexicalItemCount == null
          ? this.repeatableLexicalItemCount
          : repeatableLexicalItemCount(),
      hintUsed: hintUsed == null ? this.hintUsed : hintUsed(),
      finishEvent: finishEvent == null ? this.finishEvent : finishEvent(),
    );
  }
}

enum RepetitionAnswerTypingCardFinishEvent {
  none,
  markedAsRemembered,
  markedAsUnremembered,
  typingModeDisabled,
  explicitMarkRequired,
  vanished;

  bool get isNone {
    return this == RepetitionAnswerTypingCardFinishEvent.none;
  }

  bool get isMarkedAsRemembered {
    return this == RepetitionAnswerTypingCardFinishEvent.markedAsRemembered;
  }

  bool get isMarkedAsUnremembered {
    return this == RepetitionAnswerTypingCardFinishEvent.markedAsUnremembered;
  }

  bool get isTypingModeDisabled {
    return this == RepetitionAnswerTypingCardFinishEvent.typingModeDisabled;
  }

  bool get isExplicitMarkRequired {
    return this == RepetitionAnswerTypingCardFinishEvent.explicitMarkRequired;
  }

  bool get isVanished {
    return this == RepetitionAnswerTypingCardFinishEvent.vanished;
  }
}
